<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="js/vue-2.4.0.js"></script>
    <script src="js/axios.min.js"></script>
</head>
<body>
<div id="app">
    <h1>AI问答系统</h1>
    <textarea rows="3" cols="50" placeholder="输入你的问题" v-model="question"></textarea>
    <br>
    <input type="button" value=" 提问 " @click="getAnswer">
    <br>
    <textarea readonly rows="10" cols="50" placeholder="ai结果" :value="answer"></textarea>
</div>
</body>
<script>
    var vm = new Vue({
        el: "#app",
        data: {
            question: '',
            answer: ''
        },
        methods: {
            getAnswer(){
                // this.answer = this.question;
                axios.get("http://localhost:8080/getAnswer", {
                    params: {
                        keywords: this.question
                    }
                }).then(response=>{
                    this.answer = response.data;
                }).catch(function (err){
                    alert(err);
                });
            }
        },
        mounted(){

        }
    });
</script>

</html>